<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('operations', function (Blueprint $table) {
            $table->id();
            $table->string('user_name')->nullable(true)->comment('用户名称');
            $table->string('type')->nullable(true)->comment('类别');
            $table->unsignedBigInteger('user_id')->nullable(true)->comment('用户id');
            $table->unsignedBigInteger('e_s_cluster_id')->comment('所属储能簇id');
            $table->string('description')->nullable(true)->comment('内容');
            $table->string('status')->nullable(true)->comment('状态');
            $table->nullableMorphs('alarm');
            $table->timestamp('time')->nullable()->comment('创建时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('operations');
    }
};
